import 'package:flutter/material.dart';
import 'package:flutter01/navigator/bottom_navigation_bar_item_option.dart';
import 'package:flutter01/navigator/tab_navigator.dart';

import 'content_page.dart';

class ReadIndex extends StatelessWidget {
  late final ContentPage tabNavigatorChild;
  late final TabNavigator tabNavigator;

  onPageChanged(index){
      tabNavigator.changeCurrentIndex(index);
  }

  @override
  Widget build(BuildContext context) {
    tabNavigatorChild = ContentPage(onPageChanged:onPageChanged);
    tabNavigator = TabNavigator(
      child: tabNavigatorChild,
      onBottomNavigationBarTap: (index) {
        tabNavigatorChild.pageController.jumpToPage(index);
      },
      bottomNavigationBarItemOptions: [
        BottomNavigationBarItemOption(
            label: "本周", icon: Icons.folder, activeIcon: Icons.folder),
        BottomNavigationBarItemOption(
            label: "分享", icon: Icons.explore, activeIcon: Icons.explore),
        BottomNavigationBarItemOption(
            label: "免费",
            icon: Icons.donut_small,
            activeIcon: Icons.donut_small),
        BottomNavigationBarItemOption(
            label: "长安", icon: Icons.person, activeIcon: Icons.person),
      ],
    );
    return Scaffold(body:tabNavigator );
  }
}
